package io.renren.modules.generator.service.impl;

import io.renren.modules.generator.entity.TTrainingDictionaryEntity;
import io.renren.modules.user.entity.TPeopleEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.TObjectDao;
import io.renren.modules.generator.entity.TObjectEntity;
import io.renren.modules.generator.service.TObjectService;


@Service("tObjectService")
public class TObjectServiceImpl extends ServiceImpl<TObjectDao, TObjectEntity> implements TObjectService {

    @Autowired
    private TObjectDao tObjectDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TObjectEntity> page = this.page(
                new Query<TObjectEntity>().getPage(params),
                new QueryWrapper<TObjectEntity>()
        );

        return new PageUtils(page);
    }

    /**
     * 列表查询
     * @param
     * @return
     */
    public PageUtils selectList(Map<String, Object> params){
        IPage<TObjectEntity> page = new Query<TObjectEntity>().getPage(params);
        List<TObjectEntity> tPeopleEntities = tObjectDao.selectList(params);
        page.setRecords(tPeopleEntities);
        return new PageUtils(page);
    }
    /**
     * 删除
     */
    public int delTObjectEntity(@Param(value = "id")Integer id){
        return tObjectDao.delTObjectEntity(id);
    }
    /**
     * 下拉框 科目分类
     */
    public List<TTrainingDictionaryEntity> getObject(){
        return tObjectDao.getObject();
    }
    /**
     * 下拉框 参与类型
     */
    public List<TTrainingDictionaryEntity> getTeam(){
        return tObjectDao.getTeam();
    }

    /**
     * 根据科目名称 找到id
     */
    public TObjectEntity getObjId(TObjectEntity objectEntity){
        return tObjectDao.getObjId(objectEntity);
    }

}